// myClassMember.js
var app = getApp(); 
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0,
    templateData: {
      memberList: []
    },
    hidden: true,
    curPage:1,
    hasMoreData: true
  },
   /**
   * 跳转下一页
   */
  toNext:function(e){
    var that = this;
    console.log("班级学员跳转===",e);
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: "/pages/myClassMemInfo/myClassMemInfo?id="+id
    })
  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var that = this;
      var curPage = that.data.curPage;
      console.log("班级学员加载options数据---",options);
      wx.request({
        url: app.globalData.http + "selectStudentByTeamId.do",
        header: {
          'content-type': 'application/json'
        },
        data:{
          teamId : parseInt(options.id),
          curPage : curPage,
          busId: parseInt(wx.getStorageSync("busId")),
          employeesId: parseInt(wx.getStorageSync("employeesId")),
          schoolId: parseInt(wx.getStorageSync("schoolId"))
         
        },
        success: function(res){
          console.log("我的班级-班级学员请求成功的数据---",res.data);
            var code = res.data.code;
            if(code == 100){
              that.setData({
                memberList: res.data.data.subList,
                curPage: curPage+1,
              })
            }
            if(code == 200){
              that.setData({
                codeTxt: "数据为空"
              })
            }
            if(code == 300){
              codeTxt: "哇哦~数据异常"
            }
        }
      })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
 
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that = this;
    var hasMoreData = that.data.hasMoreData;
    var url = app.globalData.http + "selectStudentByTeamId.do";
    utils.loadMore(that,hasMoreData,url)  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})